package com.minjiang.service.impl;

import com.minjiang.dao.AccountMapper;
import com.minjiang.dao.Impl.AccountMapperDao;
import com.minjiang.pojo.Account;
import com.minjiang.service.AccountService;
import org.mybatis.spring.SqlSessionTemplate;

public class AccountServiceImpl implements AccountService {
    AccountMapper accountMapper = new AccountMapperDao();

    public int update(int id, float money) {
        return update(id, money);
    }

    public void updateto(int id, String name, String name2,float money) {
        Account account = accountMapper.queryUserById(name);
        Account account1 = accountMapper.queryUserById(name2);
        int id1 = account.getId();
        float money1 = account.getMoney();
        int id2 = account1.getId();
        float money2 = account.getMoney();
        update(id1,money1+money);
        update(id2,money2-money);
    }
}
